package com.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.entity.ProjectEntity;

@Repository
public class ProjectDaoImpl extends GenericDaoImpl<ProjectEntity> implements ProjectDao {

	public ProjectEntity getProjectById(int id) {
		return getById(ProjectEntity.class, id);
	}

	public List<ProjectEntity> getAllProject() {
		return getAll(ProjectEntity.class);
	}

	public ProjectEntity getProjectByUniqueId(String id) {
		String hql = "From ProjectEntity where id= :id";
		Query query = sessionFactory.getCurrentSession().createQuery(hql);
		query.setParameter("id",id);		
		return (ProjectEntity) query.uniqueResult();
	}
	
}
